<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="false">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row :gutter="48">
          <a-divider>基本信息</a-divider>
          <a-col :span="8" :hidden="true">
            <a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bpmBizTitle">
              <a-input :disabled="formDisabled" v-model="model.bpmBizTitle" placeholder="请输入标题"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="单据编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="billNo">
              <a-input v-model="model.billNo" placeholder="请输入单据编号" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="handlerId">
              <select-user-by-dep placeholder="请选择申请人" v-model="model.handlerId" disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="handlerDeptId">
              <j-select-depart placeholder="请选择申请部门" v-model="model.handlerDeptId" disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime">
              <j-date
                placeholder="请选择申请时间"
                v-model="model.createTime"
                :show-time="true"
                date-format="YYYY-MM-DD HH:mm:ss"
                style="width: 100%"
                disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            
            <a-form-model-item v-if="revokedType" label="报告审核单" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="purchaseBillId">
              <SelectAuditFormList :disabled="formDisabled" v-model="model.purchaseBillId" @resultList="resultData" @back="dataList" placeholder="请选择"/>
            </a-form-model-item>
          </a-col>
          <a-divider>项目信息</a-divider>
          <a-col :span="8">
            <a-form-model-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectId">
              <template v-if="!formDisabled">
                <select-project-input
                  v-model="model.projectId"
                  placeholder="请输入选择项目"
                  :proDisabled="true"
                  :projectStatus="'2'"
                  :disabled="formDisabled || revokedType || formBpm"
                  @input="handleProjectIdChange" />
              </template>
              <a-input
                v-else
                :readOnly="true"
                v-model="model.projectId_dictText"
                style="color: #1890FF;"
                @click.prevent="getProjectDetail(model.projectId)"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="finalNo">
              <a-input
                :disabled="autoFieldDisabled"
                v-model="model.finalNo"
                :max-length="36"
                placeholder="请输入项目编号"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="关联任务" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskId">
              <a-tooltip placement="topLeft">
                <template slot="title" v-if="!model.projectId">
                  <span>请选择项目名称</span>
                </template>
                <select-task-file-input
                  v-model="model.taskId"
                  :projectId="model.projectId"
                  :disabled="formDisabled || revokedType || formBpm"
                  :isExcludeWaitingStatus="true"
                  @input="handleTaskIdChange" />
              </a-tooltip>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="业务名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryName">
              <a-input :disabled="autoFieldDisabled" v-model="model.categoryName" placeholder="请输入业务名称"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectLeading">
              <select-user-by-dep placeholder="请输入项目负责人" :disabled="autoFieldDisabled" v-model="model.projectLeading" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="生产团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productTeam">
              <select-team-input
                placeholder="请选择生产团队"
                v-model="model.productTeam"
                :disabled="autoFieldDisabled"
                :tdlx="2"
                :triggerChange="true" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="实施部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="executeDepart">
              <j-select-depart :disabled="autoFieldDisabled" v-model="model.executeDepart" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="资质单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qualificationUnit">
              <select-company-input :disabled="formDisabled || revokedType || formBpm" v-model="model.qualificationUnit" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="签订单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="signUnit">
              <select-company-input :disabled="autoFieldDisabled" v-model="model.signUnit" placeholder="请选择签订单位" />
            </a-form-model-item>
          </a-col>
          <a-col :span="16">
            <a-form-model-item
              label="项目所在地址"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              style="height:75px"
              prop="projectAddress">
              <a-form-model-item
                prop="ssq"
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                :style="{display:'inline-block',width:'48%'}">
                <AddressChoice
                  :disabled="autoFieldDisabled"
                  type="cascader"
                  v-model="model.areaCode"
                  placeholder="请输入省市区" />
              </a-form-model-item>
              <a-form-model-item
                prop="projectAddress"
                :labelCol="labelCol"
                :wrapperCol="wrapperCol"
                :style="{'margin-top':'0px','margin-left':'5px',display:'inline-block',width:'50%'}">
                <a-input :disabled="autoFieldDisabled" v-model="model.projectAddress" placeholder="请输入项目详细地址"></a-input>
              </a-form-model-item>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
                <a-form-model-item label="任务类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskType">
                  <j-dict-select-tag
                    type="list"
                    disabled
                    v-model="model.taskType"
                    dictCode="task_type"
                    placeholder="请选择任务类型"/>
                </a-form-model-item>
              </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="行业类别"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="industryCategory">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.industryCategory"
                dictCode="industry_category"
                placeholder="请选择行业类别" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="行业系数"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="industryCoefficient">
              <a-input-number
                :precision="1"
                :disabled="formDisabled"
                v-model="model.industryCoefficient"
                placeholder="请输入行业系数"
                :min="0"
                :max="99999"
                style="width: 100%;" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="审批类别"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="approvalLevel">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.approvalLevel"
                dictCode="approval_level"
                placeholder="请输入审批类别" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="审批系数"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="approvalCoefficient">
              <a-input-number
                :precision="1"
                :disabled="formDisabled"
                v-model="model.approvalCoefficient"
                placeholder="请输入审批系数"
                :min="0"
                :max="99999"
                style="width: 100%;" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="复杂程度"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="complexity">
              <j-dict-select-tag
                :disabled="formDisabled"
                type="list"
                v-model="model.complexity"
                dictCode="industry_coefficient"
                placeholder="请选择复杂程度" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item
              v-if="hideFlag=='1'"
              label="复杂系数"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="complexCoefficient">
              <a-input-number
                :precision="1"
                :disabled="formDisabled"
                v-model="model.complexCoefficient"
                placeholder="请输入复杂系数"
                :min="0"
                :max="99999"
                style="width: 100%;" />
            </a-form-model-item>
          </a-col> -->
          <a-col :span="24">
            <a-form-model-item label="任务最终成果报告名称(全称)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectResult">
              <a-textarea
                :disabled="formDisabled || revokedType || projectLeaderDiabled"
                :max-length="1000"
                v-model="model.projectResult"
                rows="6"
                placeholder="请输入任务最终成果报告名称(全称)" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-textarea
                :disabled="formDisabled || revokedType || formBpm"
                :max-length="200"
                v-model="model.remark"
                rows="4"
                placeholder="请输入备注" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-collapse v-model="activeKey">
          <a-collapse-panel key="1" header="一审工程师">
            <a-row :gutter="48">
              <ErpFirstInstanceEngineerList @dataOne="dataOneFun"  :revokedType="revokedType" :formBpm="formBpm"  :formDisabled="formDisabled" ref="firstInstanceEngineerTable" :disabled="firstInstanceEngineer" :twoProjectSpecialist="twoProjectSpecialist" />
              <a-col :span="24" >
                <h4 style="margin-top: 15px;">一审结果文件:</h4>
            <a-form-model-item label="任务附件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oneResultFile">
              <j-upload v-if="!firstInstanceEngineer" :disabled="firstInstanceEngineer" v-model="model.oneResultFile"></j-upload>
              <a-button v-else icon="download" :disabled="isRequesting" @click="viewFileOne(model.oneResultFile)">文件列表</a-button>
            </a-form-model-item>
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-textarea
              :disabled="twoProjectSpecialist" 
                :max-length="200"
                v-model="model.oneRemark"
                rows="4"
                placeholder="请输入备注" />
            </a-form-model-item>
              </a-col>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel key="2" header="二审主持工程师">
            <a-row :gutter="48">
              <ErpSecondInstancePresidingEngineerForm :revokedType="revokedType" ref="secondInstancePresidingEngineerForm"  :oneProjectSpecialist="oneProjectSpecialist" :twoProjectSpecialist="twoProjectSpecialist" :secondInstancePresidingEngineer="secondInstancePresidingEngineer" />
              <a-col :span="24" >
                <h4 style="margin-top: 15px;">二审结果文件:</h4>
            <a-form-model-item label="任务附件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="twoHostResultFile">
              <j-upload v-if="!secondInstancePresidingEngineer" :disabled="secondInstancePresidingEngineer" v-model="model.twoHostResultFile"></j-upload>
              <a-button v-else icon="download" :disabled="isRequesting" @click="viewFileOne(model.twoHostResultFile)">文件列表</a-button>
            </a-form-model-item>
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-textarea
              :disabled="twoProjectSpecialist" 
                :max-length="200"
                v-model="model.twoHostRemark"
                rows="4"
                placeholder="请输入备注" />
            </a-form-model-item>
              </a-col>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel key="3" header="二审会审工程师">
            <a-row :gutter="48">
              <ErpSecondInstanceReviewEngineerForm :revokedType="revokedType" ref="secondInstanceReviewEngineerForm" :oneProjectSpecialist="oneProjectSpecialist" :twoProjectSpecialist="twoProjectSpecialist" />
              <a-col :span="24">
                <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
              <a-textarea
              :disabled="twoProjectSpecialist"
                :max-length="200"
                v-model="model.twoJointReviewRemark"
                rows="4"
                placeholder="请输入备注" />
            </a-form-model-item>
              </a-col>

            </a-row>
          </a-collapse-panel>
          <a-collapse-panel v-if="model.taskType === '1'" key="4" header="三审工程师">
            <a-row :gutter="48">
              <ErpThirdReviewEngineerForm :revokedType="revokedType" ref="thirdReviewEngineerForm" :oneProjectSpecialist="oneProjectSpecialist" :twoProjectSpecialist="twoProjectSpecialist" />
              <a-col :span="24">
                <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
                  <a-textarea
                    :disabled="twoProjectSpecialist"
                    :max-length="200"
                    v-model="model.threeRemark"
                    rows="4"
                    placeholder="请输入备注" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-collapse-panel>
          <a-collapse-panel v-if="model.taskType === '1'" key="5" header="专审人员">
            <!-- <div style="margin-bottom: 6px;margin-top: 6px" >
                  <a-button  type="primary">新增</a-button>
                </div> -->
                <a-row :gutter="48">
                  <ErpSpecializedAuditorsForm :revokedType="revokedType" ref="specializedAuditorsForm" :oneProjectSpecialist="oneProjectSpecialist" :twoProjectSpecialist="twoProjectSpecialist" />
                  <a-col :span="24">
                <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="specializedRemark">
              <a-textarea
              :disabled="twoProjectSpecialist"
                :max-length="200"
                v-model="model.specializedRemark"
                rows="4"
                placeholder="请输入备注" />
            </a-form-model-item>
              </a-col>
                </a-row>
          </a-collapse-panel>
        </a-collapse>
        <!-- <a-row :gutter="48" v-if="formBpm && model.bpmStatus !== '1'">
          <a-col :span="8">
            <a-form-model-item
              label="工程师（二审）"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="engineerSecondReview">
              <select-user-by-dep
                :disabled="disabledInForm||projectCommissioner"
                v-model="model.engineerSecondReview" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="工程师（三审）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="engineerThirdReview">
              <select-user-by-dep :disabled="disabledInForm||projectCommissioner" v-model="model.engineerThirdReview" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目评审情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reviewResult">
              <j-dict-select-tag
                :disabled="disabledInForm||projectLeading"
                type="list"
                v-model="model.reviewResult"
                dictCode="review_result"
                placeholder="请选择项目评审情况" />
            </a-form-model-item>
          </a-col>
        </a-row> -->
        <a-row :gutter="48">
          <!-- <a-col :span="8" v-if="formBpm && model.bpmStatus !== '1'">
            <a-form-model-item  label="二审审核费" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="secondReviewFee">
              <a-input-number
                :disabled="disabledInForm||otherEdit"
                :max="999999999"
                :min="0"
                :precision="2"
                v-model="model.secondReviewFee"
                placeholder="请输入二审审核费"
                style="width: 100%" />
            </a-form-model-item>
          </a-col> -->
          <!-- <a-col :span="8" v-if="formBpm && model.bpmStatus !== '1'">
            <a-form-model-item label="专审人员" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="specializedAuditors">
              <select-user-by-dep
                :disabled="disabledInForm || projectCommissioner"
                placeholder="请选择专审人员"
                v-model="model.specializedAuditors" />
            </a-form-model-item>
          </a-col> -->
          <!-- <a-col :span="24" v-if="formBpm && model.bpmStatus !== '1'">
            <a-form-model-item
              label="二审审核费计算过程"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="secondReviewProcess">
              <a-textarea
                :disabled="disabledInForm||otherEdit"
                :max-length="1000"
                v-model="model.secondReviewProcess"
                rows="6"
                placeholder="请输入二审审核费计算过程" />
            </a-form-model-item>
          </a-col> -->
          <!-- <a-col :span="8" v-if="formBpm && model.bpmStatus !== '1'">
            <a-form-model-item label="三审审核费" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="thirdReviewFee">
              <a-input-number
                :disabled="disabledInForm||otherEdit"
                :max="999999999"
                :min="0"
                :precision="2"
                v-model="model.thirdReviewFee"
                placeholder="请输入三审审核费"
                style="width: 100%" />
            </a-form-model-item>
          </a-col> -->
          <!-- <a-col :span="24" v-if="formBpm && model.bpmStatus !== '1'">
            <a-form-model-item
              label="三审审核费计算过程"
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              prop="thirdReviewProcess">
              <a-textarea
                :disabled="disabledInForm||otherEdit"
                :max-length="1000"
                v-model="model.thirdReviewProcess"
                rows="6"
                placeholder="请输入三审审核费计算过程" />
            </a-form-model-item>
          </a-col> -->
          <a-col :span="8">
            <a-form-model-item label="费用所属团队" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="feeTeamId">
              <select-team-input
                :disabled="projectLeader"
                placeholder="请选择费用所属团队"
                v-model="model.feeTeamId"
                :tdlx="3" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="项目评审情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reviewResult">
              <j-dict-select-tag
                :disabled="projectLeader"
                type="list"
                v-model="model.reviewResult"
                dictCode="review_result"
                placeholder="请选择项目评审情况" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8" v-if="model.taskType === '1'">
            <a-form-model-item label="报告类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reportType">
              <j-dict-select-tag
                type="list"
                :disabled="formDisabled || revokedType || formBpm"
                v-model="model.reportType"
                dictCode="report_audit_report_type"
                placeholder="请选择报告类型" />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="任务附件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="file">
              <j-upload v-if="!formBpm && !revokedType" :disabled="formDisabled || revokedType" v-model="model.file"></j-upload>
              <a-button v-else icon="download" @click="viewFileOne(model.file)">文件列表</a-button>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item v-if="revokedType" label="作废说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invalidRemark">
              <a-textarea
                :disabled="formDisabled"
                :max-length="500"
                v-model="model.invalidRemark"
                rows="4"
                placeholder="请输入作废说明" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <common-flow-list
          v-if="formBpm && model.bpmStatus !== '1'"
          :formData="formData"
          style="margin-top: 10px"></common-flow-list>
      </a-form-model>
    </j-form-container>
    <a-row :gutter="48">
      <a-col :span="24" style="text-align: center;margin-top: 15px">
        <a-button
          type="primary"
          v-if="formBpm"
          :style="{ marginRight: showFlowSubmitButton?'10px':'15px' }"
          @click="onPrint">打印
        </a-button>
        <!-- <a-button v-if="!revokedType && formBpm" @click="submitForm('submit')">提 交</a-button> -->
        <a-button v-if="isShowFlowSubmitButton" @click="submitForm('submit')">提 交</a-button>
      </a-col>
    </a-row>
    <!-- 项目详情开始 -->
    <erp-project-report-modal ref="reportForm"></erp-project-report-modal>
    <view-file-modal ref="viewFileModal"></view-file-modal>
    <ErpReportAuditFormPrint
      v-if="formBpm && isSubmit"
      class="print_style"
      id="reportAudit"
      :formData="model1"
      :formDataHistory="formData"></ErpReportAuditFormPrint>
  </a-spin>
</template>

<script>

import { getAction, httpAction } from '@/api/manage'
import ErpSecondInstancePresidingEngineerForm from './reference/ErpSecondInstancePresidingEngineerForm'
import ErpSecondInstanceReviewEngineerForm from './reference/ErpSecondInstanceReviewEngineerForm'
import ErpFirstInstanceEngineerList from './reference/ErpFirstInstanceEngineerList'
import ErpThirdReviewEngineerForm from './reference/ErpThirdReviewEngineerForm'
import ErpSpecializedAuditorsForm from './reference/ErpSpecializedAuditorsForm'
import SelectUserByDep from '@/views/scy/components/SelectUserByDep'
import SelectTeamInput from '@/views/scy/components/SelectTeamInput'
import SelectCompanyInput from '@/views/scy/components/SelectCompanyInput'
import SelectCustomerInput from '@/views/scy/components/SelectCustomerInput'
import SelectProjectTaskInput from '@/views/scy/components/SelectProjectTaskInput'
import BusinessCategorySelect from '@views/erp/components/BusinessCategorySelect'
import SelectProjectInput from '@/views/scy/components/SelectProjectInput'
import AddressChoice from '@/components/AddressChoice/AddressChoice'
import SelectTaskFileInput from '@/views/scy/components/SelectTaskFileInput'
import ViewFileModal from '@/views/scy/components/ViewFileModal'
import { viewFile } from '@/utils/util'
import moment from 'moment'
import SelectAuditFormList from '@views/erp/omc/reportaudit/modules/reference/SelectAuditFormList.vue'

import { mapGetters } from 'vuex'
import ErpProjectReportModal from '@/views/erp/report/project/modules/ErpProjectReportModal'
import CommonFlowList from '@/views/components/CommonFlowList.vue';
import Print from '@/utils/print/printarea.js';
import ErpReportAuditFormPrint from './ErpReportAuditFormPrint' // 打印
import { filterMultiDictText, initDictOptions } from '@/components/dict/JDictSelectUtil'

export default {
  name: 'ErpReportAuditForm',
  mixins: [viewFile],
  components: {
    CommonFlowList,
    ErpSecondInstancePresidingEngineerForm,
    ErpSecondInstanceReviewEngineerForm,
    ErpFirstInstanceEngineerList, // 第一审
    ErpThirdReviewEngineerForm,
    ErpSpecializedAuditorsForm,
    ErpProjectReportModal,
    SelectUserByDep,
    SelectTeamInput,
    SelectCompanyInput,
    SelectCustomerInput,
    SelectProjectTaskInput,
    BusinessCategorySelect,
    SelectProjectInput,
    AddressChoice,
    SelectTaskFileInput,
    ViewFileModal,
    SelectAuditFormList,
    ErpReportAuditFormPrint
  },
  props: {
    // 流程表单data
    formData: {
      type: Object,
      default: () => {
      },
      required: false
    },
    // 表单模式：true流程表单 false普通表单
    formBpm: {
      type: Boolean,
      default: false,
      required: false
    },
    // 表单禁用
    disabled: {
      type: Boolean,
      default: false,
      required: false
    },
    deleteAbled:{
      type: Boolean,
      default: false,
      required: false
    }
  },
  data() {
    return {
      model: {
        projectId: '',
        twoJointReviewRemark:'',
        threeRemark:'',
        oneResultFile:'',
        oneRemark:'',
        //第二阶段主持审核结果文件
        twoHostResultFile:'',
        twoHostRemark:'',
        specializedRemark:''
      },
      model1: {
        projectId: ''
      },
      
      revokedType:'', // 是否作废判断
      firstAuditEngineers:[],
      applys:'',
      isRequesting:false,
      firstInstanceEngineerTable:null,
      secondInstancePresidingEngineerForm:null,
      secondInstanceReviewEngineerForm:null,
      thirdReviewEngineerForm:null,
      specializedAuditorsForm:null,
      activeKey:['1','2','3','4','5','6'],
      isSubmit: true,
      labelCol: {},
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 24 }
      },
      confirmLoading: false,
      validatorRules: {
        projectId: [
          { required: true, message: '请选择项目名称!' }
        ],
        taskId: [
          { required: true, message: '请选择关联任务!' }
        ],
        qualificationUnit: [
          { required: true, message: '请选择资质单位!' }
        ],
        projectResult: [
          { required: true, message: '请输入任务最终成果报告名称(全称)!' }
        ],
        engineerSecondReview: [
          { required: true, message: '请选择工程师（二审）!' }
        ],
        reviewResult: [
          { required: true, message: '请选择项目评审情况!' }
        ],
        secondReviewFee: [
          { required: true, message: '请输入二审审核费!' }
        ],
        secondReviewProcess: [
          { required: true, message: '请输入二审审核费计算过程!' }
        ],
        feeTeamId: [
          { required: true, message: '请选择费用所属团队!' }
        ],
        reportType: [
          { required: true, message: '请选择报告类型!' }
        ],
        invalidRemark: [
          { required: true, message: '请输入作废说明!' }
        ]
      },
      url: {
        add: '/api/erp/omc/reportaudit/erpReportAudit/add',
        edit: '/api/erp/omc/reportaudit/erpReportAudit/edit',
        queryById: '/api/erp/omc/reportaudit/erpReportAudit/queryById',
        // 获取表单编号
        getBillNo: '/api/erp/base/generatedFormNumber',
        queryTaskById: '/api/erp/omc/project/erpOmcProjectTaskFinal/queryPageList',
        // 穿透项目名称
        queryProjectReportById: '/api/erp/project/report/erpProjectReport/queryById',
        // 作废申请单列表
        generatedFormNumber:'/api/erp/base/generatedFormNumber'
      },
      hideFlag: '0',
      projectIdBack: null,
      // 代码生成后需手动设置流程编码
      flowCode: 'onl_erp_report_audit',
      formUrl: '/erp/omc/reportaudit/modules/ErpReportAuditForm',
      formUrlMobile: '',
      beanName: 'ErpReportAuditFlow',
      dictOptions: {}
    }
  },
  computed: {
    // 自动带出需要禁止输入的字段
    autoFieldDisabled() {
      return true;
    },
    // 普通字段表单验证
    formDisabled() {
      console.log(this.formBpm,'普通的---');
      
      if (this.formBpm === true) {
        if (this.formData.disabled === false) {
          return false
        }
        return true
      }
      return this.disabled
    },
    // 流程中是否提交按钮
    showFlowSubmitButton() {
      if (this.formBpm === true) {
        console.log('formData-----', this.formData)
        if (this.formData.isValForm === '1') {
          return true
        }
      }
      return false
    },
    isShowFlowSubmitButton() {
      if (this.formBpm === true) {
        if (this.formData.taskDefKey === 'task1681387080566' || this.formData.taskDefKey === 'task1681387104415' || this.formData.taskDefKey === 'task1681387124847' || this.formData.taskDefKey === 'task1681387326266' || this.formData.taskDefKey === 'task1743069459444') {
          // console.log('sssssssssss----');
          
          return true;
        }
      }
      return false;
    },
    // 非流程中禁用的字段
    disabledInForm() {
      if (this.formBpm === false) {
        return true;
      }
    },
    // 审批节点项目专员
    projectCommissioner() {
      // 流程中除项目专员不可编辑
      if (this.formBpm === true) {
        // 已办不让编辑
        if (this.formData.isComplated === '1') {
          return true;
        }
        if (this.formData.taskDefKey === 'task1681387104415') {
          return false;
        }
      }
      return true;
    },
    // 项目负责人
    projectLeading() {
      if (this.formBpm === true) {
        // 已办不让编辑
        if (this.formData.isComplated === '1') {
          return true;
        }
        if (this.formData.taskDefKey === 'task1681387260933') {
          return false;
        }
      }
      return true;
    },


    // 一审工程师
    firstInstanceEngineer() {
      if (this.formBpm === true) {
        // // 已办不让编辑
        // if (this.formData.isComplated === '1') {
        //   return true;
        // }
        if (this.formData.taskDefKey === 'task1681387080566') {
          // console.log('sssssssssss----');
          
          return false;
        }
      }
      return true;
    },
    
    // 第一个审批节点的项目专员
    oneProjectSpecialist() {
      if (this.formBpm === true) {
        // // 已办不让编辑
        // if (this.formData.isComplated === '1') {
        //   return true;
        // }
        if (this.formData.taskDefKey === 'task1681387104415') {
          console.log('哈哈哈--');
          
          return false;
        }
      }
      return true;
    },
    // 第二个审批节点的项目专员
    twoProjectSpecialist() {
      if (this.formBpm === true) {
        // // 已办不让编辑
        // if (this.formData.isComplated === '1') {
        //   return true;
        // }
        if (this.formData.taskDefKey === 'task1681387326266') {
          return false;
        }
      }
      return true;
    },
     // 二审主持工程师
     secondInstancePresidingEngineer() {
      if (this.formBpm === true) {
        // // 已办不让编辑
        // if (this.formData.isComplated === '1') {
        //   return true;
        // }
        if (this.formData.taskDefKey === 'task1681387124847') {
          return false;
        }
      }
      return true;
    },
     
    // 报告审核单负责人
    projectLeader(){
      if (this.formBpm === true) {

        if (this.formData.taskDefKey === 'task1743069459444') {
          return false;
        }
      }
      return true;
    },
    projectLeaderDiabled(){
        if (this.formData && this.formData.taskDefKey === 'task1743069459444') {
          return false;
        }else{
          return this.formBpm;
        }
    },
      
    // 二审人员和总工办负责人和专审人员 可编辑
    otherEdit() {
      if (this.formBpm === true) {
        // 已办不让编辑
        if (this.formData.isComplated === '1') {
          return true;
        }
        if (this.formData.taskDefKey === 'task1681387324230' || this.formData.taskDefKey === 'task1681387326266' || this.formData.taskDefKey === 'task1729505123535') {
          return false;
        }
      }
      return true;
    }
  },
  created() {
    // 备份model原始值
    this.modelDefault = JSON.parse(JSON.stringify(this.model));
    // 如果是流程中表单，则需要加载流程表单data
    this.showFlowData();
    this.initDictConfig()
  },
  methods: {
    ...mapGetters(['userInfo']),
    // 获取单据编号
    getBillNo() {
      var params = {}
      if (this.revokedType) {
        params = {
          prefix:'ZFBGSHD',
          subSystemCode:'05'
        }
      } else {
        params = {
          prefix:'BGSHD',
          subSystemCode:'05'
        }
      }
      getAction(this.url.getBillNo, params).then((res) => {
        if (res.success) {
          // that.$set(that,'billNo',res.result)
          this.$set(this.model, 'billNo', res.result)
          if (!that.revokedType) {
              that.model.bpmBizTitle = '报告审核单-' + that.model.billNo// 标题
            } else {
              that.$set(that.model, 'bpmBizTitle', '作废-报告审核单' + '-' + that.model.billNo)
            }
        }
      }).catch(err => {
        console.log(err)
      }).finally(() => {
        this.check()
      })
    },
    async viewFileOne(text) {
      if (!text) {
        this.$message.warning('无可下载文件')
        return
      }
      try {
        this.isRequesting = true;
        await this.$refs.viewFileModal.show(text);
        this.isRequesting = false;
        } catch (error) {
        } finally {
          // 无论成功或失败，最后解锁按钮
          this.isRequesting = false;
        }

    },
    resultData(data){
        console.log(data,'result0000');
        this.$nextTick(()=>{
          this.model.file = data.file || null


              if(this.$refs.secondInstancePresidingEngineerForm){
                this.$refs.secondInstancePresidingEngineerForm.dataSource = data.secondAuditChairmanEngineers || []
              this.$refs.secondInstancePresidingEngineerForm.model.remark = data.secondAuditChairmanEngineers[0].remark || ''
              this.$refs.secondInstancePresidingEngineerForm.model.attachment = data.secondAuditChairmanEngineers && data.secondAuditChairmanEngineers[0].attachment || ''
              }
                               this.$refs.secondInstanceReviewEngineerForm.model.remark = data.twoJointReviewRemark || ''
                               this.model.twoJointReviewRemark = data.twoJointReviewRemark || ''
                               this.model.threeRemark = data.threeRemark || ''
                               this.model.oneResultFile = data.oneResultFile || ''
                                this.model.oneRemark = data.oneRemark || ''
                                this.model.twoHostResultFile = data.twoHostResultFile || ''
                                this.model.twoHostRemark = data.twoHostRemark || ''
                                this.model.specializedRemark = data.specializedRemark || ''
                               this.$set(this.model,'twoJointReviewRemark',data.twoJointReviewRemark)
                               this.$set(this.model,'threeRemark',data.threeRemark)
                               this.$set(this.model,'remark',data.remark)
                // this.$refs.thirdReviewEngineerForm.model.remark = data.threeRemark || ''
              if(this.$refs.secondInstanceReviewEngineerForm){
                this.$refs.secondInstanceReviewEngineerForm.dataSource = data.secondAuditReviewEngineers || []
                // this.$refs.secondInstanceReviewEngineerForm.model.remark = data.secondAuditReviewEngineers && data.secondAuditReviewEngineers[0].remark || ''
              }
              if(this.$refs.thirdReviewEngineerForm){
                this.$refs.thirdReviewEngineerForm.dataSource = data.thirdAuditEngineers || []
                // this.$refs.thirdReviewEngineerForm.model.remark = data.thirdAuditEngineers && data.thirdAuditEngineers[0].remark || ''
              }

              if(this.$refs.specializedAuditorsForm){
              this.$refs.specializedAuditorsForm.dataSource = data.specialistAuditPersonnel || []
              this.$refs.specializedAuditorsForm.model.remark = data.specialistAuditPersonnel && data.specialistAuditPersonnel[0].remark || ''
              } 

              this.$refs.firstInstanceEngineerTable.dataSource = data.firstAuditEngineers || []
              this.$refs.firstInstanceEngineerTable.model.remark = data.firstAuditEngineers && data.firstAuditEngineers[0].remark || ''
              this.$refs.firstInstanceEngineerTable.model.attachment = data.firstAuditEngineers && data.firstAuditEngineers[0].attachment || ''



        })
        
    },
    dataList(data){
      console.log(data,'data-');

      let project = data[0]
      if (project) {
        this.$set(this.model, 'invalidationPurchaseBill', project.billNo) // 作废的单据编号
        // this.$set(this.model, 'purchaseBillId', project.id) // 
        // this.model = {...project }
        // 赋值
        this.projectIdBack = project.projectId
        
        this.handleProjectIdChange({choseObj: data}) // 项目
        this.handleTaskIdChange({choseObj: data}) // 任务
        this.$set(this.model, 'projectId', project.projectId)
        this.$set(this.model, 'operateTeamId', project.teamName)
        // this.$set(this.model, 'finalNo', project.finalNo)
        this.$set(this.model, 'taskId', project.taskId)
        this.$set(this.model,'twoJointReviewRemark',project.twoJointReviewRemark)
        this.$set(this.model,'threeRemark',project.threeRemark)
        this.$set(this.model,'oneResultFile',project.oneResultFile)
        this.$set(this.model,'oneRemark',project.oneRemark)
        this.$set(this.model,'twoHostResultFile',project.twoHostResultFile)
        this.$set(this.model,'twoHostRemark',project.twoHostRemark)
        this.$set(this.model,'specializedRemark',project.specializedRemark)

        this.$set(this.model, 'qualificationUnit', project.qualificationUnit) // 资质单位
        this.$set(this.model, 'projectResult', project.projectResult) // 任务最终成果报告名称(全称)
        this.$set(this.model, 'reportType', project.reportType) 
        this.$set(this.model, 'feeTeamId', project.feeTeamId) 
        this.$set(this.model, 'reviewResult', project.reviewResult) 
        this.$set(this.model, 'projectApprovalUser', project.projectApprovalUser) 
        this.$set(this.model, 'oneCheckUser', project.oneCheckUser) 
        this.$set(this.model,'remark',project.remark)
        this.$set(this.model, 'engineerSecondReview', project.engineerSecondReview) 
        this.$set(this.model, 'specializedAuditors', project.specializedAuditors) 
        // this.$set(this.model, 'handlerDeptCode_dictText', project.handlerDeptCode_dictText) 
        // this.$set(this.model, 'thirdReviewProcess', project.thirdReviewProcess) 
        // this.$set(this.model, 'bpmStatus_dictText', project.bpmStatus_dictText) 
        this.$set(this.model, 'industryCategory', project.industryCategory) 
        this.$set(this.model, 'industryCoefficient', project.industryCoefficient)  
        this.$set(this.model, 'complexity', project.complexity) 
        this.$set(this.model, 'complexCoefficient', project.complexCoefficient) 
        this.$set(this.model, 'approvalCoefficient', project.approvalCoefficient) 
        this.$set(this.model, 'approvalLevel', project.approvalLevel) 
        // this.$set(this.model, 'invalidationDepartId_dictText', project.invalidationDepartId_dictText) 
        // this.$set(this.model, 'feeTeamId_dictText', project.feeTeamId_dictText) 
        // this.$set(this.model, 'executeDepart_dictText', project.executeDepart_dictText) 
        // this.$set(this.model, 'engineerSecondReview_dictText', project.engineerSecondReview_dictText) 
        // this.$set(this.model, 'qualificationUnit', project.qualificationUnit) 
        // this.$set(this.model, 'projectResult', project.projectResult) 
        // this.$set(this.model, 'approvalLevel_dictText', project.approvalLevel_dictText) 
        // this.$set(this.model, 'projectApprovalUser', project.projectApprovalUser) 
        // this.$set(this.model, 'reportType', project.reportType) 
        // this.$set(this.model, 'invalidationProposer_dictText', project.invalidationProposer_dictText) 
        // this.$set(this.model, 'thirdReviewFee', project.thirdReviewFee) 
        // this.$set(this.model, 'purchaseBillId_dictText', project.purchaseBillId_dictText) 
        // this.$set(this.model, 'specializedRemark', project.specializedRemark) 
        // this.$set(this.model, 'complexity_dictText', project.complexity_dictText) 
        // this.$set(this.model, 'id', project.id) 
        // this.$set(this.model, 'billType_dictText', project.billType_dictText) 
        // this.$set(this.model, 'billNo', project.billNo) 
        // this.$set(this.model, 'secondReviewProcess', project.secondReviewProcess) 
        // this.$set(this.model, 'handlerDeptId', project.handlerDeptId) 
        // this.$set(this.model, 'taskType_dictText', project.taskType_dictText) 
        // this.$set(this.model, 'projectId_dictText', project.projectId_dictText) 
        // this.$set(this.model, 'oneResultFile', project.oneResultFile) 
        // this.$set(this.model, 'twoHostRemark', project.twoHostRemark) 
        // this.$set(this.model, 'engineerThirdReview_dictText', project.engineerThirdReview_dictText) 
        // this.$set(this.model, 'handlerDeptCode', project.handlerDeptCode) 
        // this.$set(this.model, 'undertaker', project.undertaker) 
        // this.$set(this.model, 'specializedAuditors_dictText', project.specializedAuditors_dictText) 
        // this.$set(this.model, 'areaCode', project.areaCode) 
        // this.$set(this.model, 'purchaseBillId', project.purchaseBillId) 
        // this.$set(this.model, 'projectApprovalUser_dictText', project.projectApprovalUser_dictText) 
        // this.$set(this.model, 'engineerSecondReview', project.engineerSecondReview) 
        // this.$set(this.model, 'engineerThirdReview', project.engineerThirdReview) 
        // this.$set(this.model, 'sysOrgCode', project.sysOrgCode) 
        // this.$set(this.model, 'projectName', project.projectName) 
        // this.$set(this.model, 'projectId', project.projectId) 
        // this.$set(this.model, 'executeDepart', project.executeDepart) 
        // this.$set(this.model, 'bpmStatus', project.bpmStatus) 
        // this.$set(this.model, 'signUnit_dictText', project.signUnit_dictText) 
        // this.$set(this.model, 'reviewResult', project.reviewResult) 
        // this.$set(this.model, 'bpmBizTitle', project.bpmBizTitle) 
        // this.$set(this.model, 'invalidationProposer', project.invalidationProposer) 
        // this.$set(this.model, 'remark', project.remark) 
        // this.$set(this.model, 'delFlag', project.delFlag) 
        // this.$set(this.model, 'categoryName', project.categoryName) 
        
        // this.$set(this.model, 'twoJointReviewRemark', project.twoJointReviewRemark) 
        // this.$set(this.model, 'taskType', project.taskType) 
        // this.$set(this.model, 'invalidationPurchaseBill', project.invalidationPurchaseBill) 
        // this.$set(this.model, 'handlerDeptId_dictText', project.handlerDeptId_dictText) 
        // this.$set(this.model, 'file', project.file) 
        // this.$set(this.model, 'twoHostResultFile', project.twoHostResultFile) 
        // this.$set(this.model, 'updateBy', project.updateBy) 
        // this.$set(this.model, 'handlerId', project.handlerId) 
        // this.$set(this.model, 'billStatus', project.billStatus) 
        // this.$set(this.model, 'invalidationCreateTime', project.invalidationCreateTime) 
        // this.$set(this.model, 'projectLeading', project.projectLeading) 
       
        // this.$set(this.model, 'billType', project.billType) 
        // this.$set(this.model, 'productTeam_dictText', project.productTeam_dictText) 
        // this.$set(this.model, 'reportType_dictText', project.reportType_dictText) 
        // this.$set(this.model, 'industryCategory_dictText', project.industryCategory_dictText) 
        // this.$set(this.model, 'updateTime', project.updateTime) 
        // this.$set(this.model, 'qualificationUnit_dictText', project.qualificationUnit_dictText) 
        // this.$set(this.model, 'categoryCode', project.categoryCode) 
        // this.$set(this.model, 'createBy_dictText', project.createBy_dictText) 
        // this.$set(this.model, 'projectLeading_dictText', project.projectLeading_dictText) 
        // this.$set(this.model, 'signUnit', project.signUnit) 
        // this.$set(this.model, 'reviewResult_dictText', project.reviewResult_dictText) 
        // this.$set(this.model, 'handlerId_dictText', project.handlerId_dictText) 
        // this.$set(this.model, 'createBy', project.createBy) 
        // this.$set(this.model, 'threeRemark', project.threeRemark) 
        // this.$set(this.model, 'invalidationDepartId', project.invalidationDepartId) 
        // this.$set(this.model, 'finalNo', project.finalNo) 
        // this.$set(this.model, 'hideFlag', project.hideFlag) 
        // this.$set(this.model, 'oneRemark', project.oneRemark) 
        // this.$set(this.model, 'createTime', project.createTime) 
        // this.$set(this.model, 'updateBy_dictText', project.updateBy_dictText) 
        // this.$set(this.model, 'secondReviewFee', project.secondReviewFee) 
        // this.$set(this.model, 'applyTeamId', project.applyTeamId) 
        // this.$set(this.model, 'projectAddress', project.projectAddress) 
        // this.$set(this.model, 'billStatus_dictText', project.billStatus_dictText) 
        // this.$set(this.model, 'feeTeamId', project.feeTeamId) 
        // this.$set(this.model, 'productTeam', project.productTeam) 
        
        // this.$set(this.model, 'invalidRemark', project.invalidRemark) 
        // this.$set(this.model, 'projectApprovalUser', project.projectApprovalUser) 
      }

    //   handleProjectIdChange(data) {
    //   let project = data.choseObj[0];

    //   if (data && project) {
    //     // 项目编号（档案编号）
    //     this.$set(this.model, 'finalNo', project.finalNo)
    //     // 项目名称
    //     this.$set(this.model, 'projectName', project.projectName)
    //     // 签订单位
    //     this.$set(this.model, 'signUnit', project.signUnit)
    //     // 项目地址
    //     this.$set(this.model, 'areaCode', project.areaCode)
    //     this.$set(this.model, 'projectAddress', project.projectAddress)
    //     // 如果当前项目和任务关联的项目不一样则清空任务
    //     if (this.projectIdBack !== project.id) {
    //       this.projectIdBack = null
    //       this.$set(this.model, 'taskId', '')
    //       // 清空任务相关字段
    //       this.resetTaskFields()
    //     }
    //   } else {
    //     // 清空所有
    //     this.restProjectFields()
    //     // 清空任务相关字段
    //     this.resetTaskFields()
    //     this.projectIdBack = null
    //     this.$set(this.model, 'taskId', '')
    //   }
    // },
    // // 选择关联任务
    // handleTaskIdChange(data) {
    //   if (data && data.choseObj[0]) {
    //     let task = data.choseObj[0]
    //     // 当前projectId
    //     this.projectIdBack = this.model.projectId
    //     // 业务名称 categoryName
    //     this.$set(this.model, 'categoryName', task.categoryName) // 业务分类
    //     this.$set(this.model, 'taskType', task.taskType) // 任务类型
    //     console.log('task.taskType',task.taskType)
    //     // 项目负责人
    //     this.$set(this.model, 'projectLeading', task.projectLeading) // 项目负责人
    //     // 生产团队
    //     this.$set(this.model, 'productTeam', task.productTeam) // 生产团队
    //     // 实施部门
    //     this.$set(this.model, 'executeDepart', task.executeDepart) // 实施部门
    //     // 带出 带不出隐藏
    //     this.fillOrHide(task, false)
    //   } else {
    //     // 清空
    //     this.resetTaskFields()
    //     this.projectIdBack = null
    //   }
    // },
      
    },

    // erpReportAuditQueryById(){

    // },


    dataOneFun(data,param){
      console.log('这些了吗==');
      
       console.log(data,'data');
       console.log(param,'param');
       
    },
    // 校验自动带出的基本信息都带出来没
    check() {
      if (!this.model.billNo || !this.model.handlerId || !this.model.handlerDeptId || !this.model.createTime) {
        this.$message.error('请刷新缓存后重试!')
      }
    },
    add (type) {
        
        this.revokedType = type == 'cancel' // 判断是否作废  true 为作废
        if (type == 'cancel') {
          this.$refs['form'].clearValidate();
          this.model = Object.assign({}, {
            billNo: '', // 作废编号
            purchaseBillId: '', // 作废id
            invalidRemark: '' // 作废原因
          })
          
          // this.purchaseBillIdBackups = null
          // this.$refs.purchaseApply.dataSource = []
          // this.userName = this.userInfo().empName;// 当前登录人名称
          this.model.handlerId = this.userInfo().empId; // 当前登录人
          this.model.handlerDeptId = this.userInfo().deptId; // 当前登录人部门
          this.model.createTime = moment().format('YYYY-MM-DD HH:mm:ss');
          this.validatorRules = {
            purchaseBillId: [
              { required: true, message: '请选择单据名称!', trigger: 'change' }
            ],
            invalidRemark: [
              { required: true, message: '请输入作废理由!', trigger: 'blur' }
            ]
          }
        } else {
          // this.applys = type
          this.validatorRules = {
            projectId: [
          { required: true, message: '请选择项目名称!' }
        ],
        taskId: [
          { required: true, message: '请选择关联任务!' }
        ],
        qualificationUnit: [
          { required: true, message: '请选择资质单位!' }
        ],
        projectResult: [
          { required: true, message: '请输入任务最终成果报告名称(全称)!' }
        ],
        reportType: [
          { required: true, message: '请选择报告类型!' }
        ],
          }



          this.edit(this.modelDefault);
          this.userName = this.userInfo().empName;// 当前登录人名称
          this.model.handlerId = this.userInfo().empId; // 当前登录人
          this.model.handlerDeptId = this.userInfo().deptId; // 当前登录人部门
          this.model.createTime = moment().format('YYYY-MM-DD HH:mm:ss');
        }
        this.getBillNo() // 获取单据编号
        this.$nextTick(()=>{
          this.$refs.firstInstanceEngineerTable.dataSource = []
                  this.model.twoJointReviewRemark = ''
                    this.model.threeRemark =  ''
                    this.model.oneResultFile = ''
                this.model.oneRemark = ''
                this.model.twoHostResultFile = ''
                this.model.twoHostRemark = ''
                this.model.specializedRemark =''
                    this.$refs.firstInstanceEngineerTable.model.remark = ''
          this.$refs.firstInstanceEngineerTable.model.attachment = ''
          this.$refs.secondInstancePresidingEngineerForm.dataSource = []

          this.$refs.secondInstanceReviewEngineerForm.dataSource = []
                   
          this.$refs.secondInstancePresidingEngineerForm.model.remark = ''
          this.$refs.secondInstancePresidingEngineerForm.model.attachment = ''
          this.$refs.secondInstanceReviewEngineerForm.model.remark = ''
          if(this.$refs.thirdReviewEngineerForm){
            this.$refs.thirdReviewEngineerForm.dataSource = []
             this.$refs.thirdReviewEngineerForm.model.remark = ''
          }
          if(this.$refs.specializedAuditorsForm){
            this.$refs.specializedAuditorsForm.dataSource = []
            this.$refs.specializedAuditorsForm.model.remark = ''
          }

         
        

        })
    },
    edit(record) {
      this.userName = this.userInfo().empName;// 当前登录人名称
      this.$refs.form.resetFields();
      this.model = Object.assign({}, record);
      this.model1 = Object.assign({}, record);
      this.revokedType = this.model.billNo ? this.model.billNo.substring(0, 2) == 'ZF' : false
      if (this.revokedType) {
          this.validatorRules = {
            purchaseBillId: [
              { required: true, message: '请选择单据名称!', trigger: 'change' }
            ],
            invalidRemark: [
              { required: true, message: '请输入作废理由!', trigger: 'blur' }
            ]
          }
          // this.purchaseBillIdBackups = this.model.purchaseBillId
        } else {
          this.validatorRules = {
            projectId: [
          { required: true, message: '请选择项目名称!' }
        ],
        taskId: [
          { required: true, message: '请选择关联任务!' }
        ],
        qualificationUnit: [
          { required: true, message: '请选择资质单位!' }
        ],
        projectResult: [
          { required: true, message: '请输入任务最终成果报告名称(全称)!' }
        ],
        reportType: [
          { required: true, message: '请选择报告类型!' }
        ],
            // teamId: [
            //   { required: true, message: '请选择团队!', trigger: 'change' }
            // ],
            // projectBudget: [
            //   { required: true, message: '请输入项目预算!', trigger: 'blur' }
            // ],
            // payManner: [
            //   { required: true, message: '请输入付款方式!', trigger: 'blur' }
            // ],
            // invitationManner: [
            //   { required: true, message: '请选择采购方式!', trigger: 'blur' }
            // ],
            // expectUseTime: [
            //   { required: true, message: '请选择期望到货时间!', trigger: 'change' }
            // ],
            // provisionBroad: [
            //   { required: true, message: '请选择物料类别!', trigger: 'change' }
            // ],
            // provisionBroadType: [
            //   { required: true, message: '请选择采购大类!', trigger: 'change' }
            // ],
            // description: [
            //   { required: true, message: '请输入采购需求及项目描述!', trigger: 'blur' }
            // ],
            // businessSegment: [
            //   { required: true, message: '请选择所属业务板块!', trigger: 'blur' }
            // ]
          }
        }
      // 当前各个字段是否必填
      this.changeValidator()
      this.visible = true;
      if (this.formBpm === true) {
        let param = {
          dataId: this.model.id,
          flowCode: this.flowCode,
          formUrl: this.formUrl,
          formUrlMobile: this.formUrlMobile,
          beanName: this.beanName
        }
        // 初始化流程数据
        this.$emit('initFlowParam', param)
      }
      this.projectIdBack = this.model.projectId
      // 初始化需要隐藏的字段
      let hideFlag = this.model.hideFlag
      this.fillOrHide(this.model, true)
      // 查询并设置是否需要隐藏字段
      this.needHide()
    },
    // 渲染流程表单数据
    showFlowData() {
      if (this.formBpm === true) {
        let params = { id: this.formData.dataId };
        getAction(this.url.queryById, params).then((res) => {
          console.log('执行了吗孙康----',res);
          if (res.success) {
            this.edit(res.result);
            this.$nextTick(()=>{
              this.$refs.firstInstanceEngineerTable.dataSource = res.result.firstAuditEngineers || []
              
              this.$refs.firstInstanceEngineerTable.model.remark = res.result.firstAuditEngineers && res.result.firstAuditEngineers[0].remark || ''
              this.$refs.firstInstanceEngineerTable.model.attachment =  res.result.firstAuditEngineers && res.result.firstAuditEngineers[0].attachment || ''
              
              if(this.$refs.specializedAuditorsForm){
                this.$refs.specializedAuditorsForm.dataSource = res.result.specialistAuditPersonnel || []
                this.$refs.specializedAuditorsForm.model.remark = res.result.specialistAuditPersonnel && res.result.specialistAuditPersonnel[0].remark || ''
              }

              if(this.$refs.secondInstancePresidingEngineerForm){
                this.$refs.secondInstancePresidingEngineerForm.dataSource = res.result.secondAuditChairmanEngineers || []
                this.$refs.secondInstancePresidingEngineerForm.model.remark = res.result.secondAuditChairmanEngineers && res.result.secondAuditChairmanEngineers[0].remark || ''
                this.$refs.secondInstancePresidingEngineerForm.model.attachment = res.result.secondAuditChairmanEngineers && res.result.secondAuditChairmanEngineers[0].attachment || ''
              }
        

                this.model.twoJointReviewRemark = res.result.twoJointReviewRemark || ''
                this.model.threeRemark = res.result.threeRemark || ''
                  this.model.oneResultFile = res.result.oneResultFile || ''
                this.model.oneRemark = res.result.oneRemark || ''
                this.model.twoHostResultFile = res.result.twoHostResultFile || ''
                this.model.twoHostRemark = res.result.twoHostRemark || ''
                this.model.specializedRemark = res.result.specializedRemark || ''
              if(this.$refs.secondInstanceReviewEngineerForm){
                this.$refs.secondInstanceReviewEngineerForm.dataSource = res.result.secondAuditReviewEngineers || []
                // this.$refs.secondInstanceReviewEngineerForm.model.remark = res.result.twoJointReviewRemark || ''
                console.log('res.result.twoJointReviewRemark',res.result.twoJointReviewRemark);
              }
              if(this.$refs.thirdReviewEngineerForm){
                this.$refs.thirdReviewEngineerForm.dataSource = res.result.thirdAuditEngineers || []
                this.$refs.thirdReviewEngineerForm.model.remark = res.result.threeRemark || ''
                console.log('res.result.threeRemark',res.result.threeRemark);

              }


               
              
              



              
              // console.log(this.$refs.specializedAuditorsForm.dataSource,'this.$refs.specializedAuditorsForm.dataSource哈哈孙康--');
              
            })
          }
        });
      }
    },

    submitForm(type) {
        const that = this;
        if (type == 'draft') {
          // 代表保存草稿不做校验
          this.submit(type)
        } else if (type == 'submit') {
          // 触发表单验证
          this.$refs.form.validate(valid => {
            if (valid) {
               console.log('执行了吗--');
              //  this.verificationFunction()
              //请选择一审工程师所属团队
              if(this.$refs.firstInstanceEngineerTable.dataSource.length === 0){
                return this.$message.warning('请选择一审工程师所属团队');
              }

               // 一审意见及附件未上传
               if (this.formBpm === true && this.formData.taskDefKey === 'task1681387080566') {
                  if(this.model.oneResultFile === '') return this.$message.warning('请上传一审意见及附件')
               }
               // 二审意见及附件未上传
               if (this.formBpm === true && this.formData.taskDefKey === 'task1681387124847') {
                  if(this.model.twoHostResultFile === '') return this.$message.warning('请上传二审结果及附件')
               }
               // 第二个审批节点的项目专员 一审审核费未填写
               if (this.formBpm === true && this.formData.taskDefKey === 'task1681387326266') {
                console.log(this.$refs.firstInstanceEngineerTable.dataSource[0].expectedAuditFee,'this.$refs.firstInstanceEngineerTable.dataSource[0].expectedAuditFee')
                if (this.$refs.firstInstanceEngineerTable.dataSource[0].expectedAuditFee === null) return this.$message.warning('一审审核费不能为空')
                if (!this.$refs.firstInstanceEngineerTable.dataSource[0].deductionRatio) return this.$message.warning('请填写一审扣除比例')
                if (this.$refs.secondInstancePresidingEngineerForm.dataSource[0].expectedAuditFee === null) return this.$message.warning('二审主持审核费不能为空')
                if (!this.$refs.secondInstancePresidingEngineerForm.dataSource[0].deductionRatio) return this.$message.warning('请填写二审主持扣除比例')
                // console.log(this.$refs.secondInstancePresidingEngineerForm.dataSource[0].signatureFee,'this.$refs.secondInstancePresidingEngineerForm.dataSource[0].signatureFee');
                if (this.$refs.secondInstancePresidingEngineerForm.dataSource[0].signatureFee === null) return this.$message.warning('二审主持签字费不能为空')
                //  console.log(this.$refs.secondInstanceReviewEngineerForm.dataSource,'this.$refs.secondAuditReviewEngineers.dataSource');
                 if(this.$refs.secondInstanceReviewEngineerForm){
                   console.log(this.$refs.secondInstanceReviewEngineerForm.dataSource,'二审会审');
                   const dataSource = this.$refs.secondInstanceReviewEngineerForm.dataSource;
                        for (let index = 0; index < dataSource.length; index++) {
                            const item = dataSource[index];
                            console.log(item, 'item');    
                            if (item.expectedAuditFee === null) {
                               return this.$message.warning('二审会审审核费不能为空');
                                // 这里不 break 会检查所有元素
                            }
                            
                            if (item.deductionRatio === undefined || item.deductionRatio === null) {
                               return this.$message.warning('二审会审扣除比例不能为空');
                            }
                            if (item.signatureFee === null) {
                               return this.$message.warning('二审会审签字费不能为空');
                            }
                        }
                 }
                 if(this.$refs.thirdReviewEngineerForm){
                  //  console.log(this.$refs.thirdReviewEngineerForm.dataSource,'二审会审');
                   const dataSource = this.$refs.thirdReviewEngineerForm.dataSource;
                        for (let index = 0; index < dataSource.length; index++) {
                            const item = dataSource[index];
                            console.log(item, 'item');    
                            if (item.expectedAuditFee === null) {
                               return this.$message.warning('三审会审审核费不能为空');
                                // 这里不 break 会检查所有元素
                            }
                            console.log(item.deductionRatio,'deductionRatio');
                            console.log(item.signatureFee,'signatureFee');
                            
                            if (item.deductionRatio === undefined || item.deductionRatio === null) {
                               return this.$message.warning('三审会审扣除比例不能为空');
                            }
                        }
                 }
                 if(this.$refs.specializedAuditorsForm && this.$refs.specializedAuditorsForm.dataSource.length){
                  console.log(this.$refs.specializedAuditorsForm,'this.$refs.specializedAuditorsForm-------------');
                  
                  if (this.$refs.specializedAuditorsForm.dataSource[0].expectedAuditFee === null) return this.$message.warning('专审审核费不能为空')
                  if (this.$refs.specializedAuditorsForm.dataSource[0].deductionRatio === undefined || this.$refs.specializedAuditorsForm.dataSource[0].deductionRatio === null) return this.$message.warning('请填写专审扣除比例')
                 }

               }
                                 
 


              // 请选择二审主持工程师
              if (this.formBpm === true && this.formData.taskDefKey === 'task1681387104415') {
               if(this.$refs.secondInstancePresidingEngineerForm.dataSource.length === 0){
                return this.$message.warning('请选择二审主持工程师');
               }                  
               if(this.$refs.secondInstanceReviewEngineerForm && this.$refs.secondInstanceReviewEngineerForm.dataSource.length > 1){
                  console.log('进来了吗----');
                                      // 创建一个用于记录empId出现次数的Map
                              const empIdMap = new Map();
                              const dataSource =  this.$refs.secondInstanceReviewEngineerForm.dataSource
                              // 遍历数组检查重复
                              const hasDuplicate = dataSource.some(item => {
                                if (empIdMap.has(item.empId)) {
                                  return true; // 发现重复立即返回true
                                }
                                empIdMap.set(item.empId, 1);
                                return false;
                              });

                              if (hasDuplicate) {
                                return this.$message.warning('不能重复添加相同人员，请检查二审会审人员列表！')
                              }
                 }
               if(this.$refs.thirdReviewEngineerForm && this.$refs.thirdReviewEngineerForm.dataSource.length > 1){
                  console.log('进来了吗----');
                                      // 创建一个用于记录empId出现次数的Map
                              const empIdMap = new Map();
                              const dataSource =  this.$refs.thirdReviewEngineerForm.dataSource
                              // 遍历数组检查重复
                              const hasDuplicate = dataSource.some(item => {
                                if (empIdMap.has(item.empId)) {
                                  return true; // 发现重复立即返回true
                                }
                                empIdMap.set(item.empId, 1);
                                return false;
                              });

                              if (hasDuplicate) {
                                return this.$message.warning('不能重复添加相同人员，请检查三审人员列表！')
                              }
                 }

           }
              that.submit(type)
            } else {
              that.$emit('unButtonDisable')
            }
          })
        } else {
          console.log('传参数，保存：draft，提交：submit')
        }
      },
      submit (type) {
        const that = this;
        that.confirmLoading = true;
        let httpurl = '';
        let method = '';
        if (!this.model.id) {
          httpurl += this.url.add;
          method = 'post';
        } else {
          httpurl += this.url.edit;
          method = 'put';
        }
        // 一审工程师
        const firstAuditEngineers = this.$refs.firstInstanceEngineerTable.dataSource.map(item => ({
              ...item,
              ...this.$refs.firstInstanceEngineerTable.model
         }));
        // 二审主持工程师
        const secondAuditChairmanEngineers = this.$refs.secondInstancePresidingEngineerForm.dataSource.map(item => ({
              ...item,
              ...this.$refs.secondInstancePresidingEngineerForm.model
         }));
        // 二审会审工程师
        const secondAuditReviewEngineers  = this.$refs.secondInstanceReviewEngineerForm.dataSource.map(item => ({
              ...item,
              ...this.$refs.secondInstanceReviewEngineerForm.model
         }));

            // 三审工程师（兼容版）
          const thirdReviewForm = this.$refs.thirdReviewEngineerForm;
          const thirdAuditEngineers = (
            (thirdReviewForm && thirdReviewForm.dataSource) || []
          ).map(item => ({
            ...item,
            ...((thirdReviewForm && thirdReviewForm.model) || {})
          }));

          // 专审工程师（兼容版）
          const specializedForm = this.$refs.specializedAuditorsForm;
          const specialistAuditPersonnel = (
            (specializedForm && specializedForm.dataSource) || []
          ).map(item => ({
            ...item,
            ...((specializedForm && specializedForm.model) || {})
          }));

        // // 三审工程师
        // const thirdAuditEngineers = this.$refs.thirdReviewEngineerForm.dataSource.map(item => ({
        //       ...item,
        //       ...this.$refs.thirdReviewEngineerForm.model
        //  }));
        // // 专审工程师
        // const specialistAuditPersonnel = this.$refs.specializedAuditorsForm.dataSource.map(item => ({
        //       ...item,
        //       ...this.$refs.specializedAuditorsForm.model
        //  }));
         console.log(firstAuditEngineers,'firstAuditEngineers--');
         console.log(secondAuditChairmanEngineers,'secondAuditChairmanEngineers--');
         console.log(secondAuditReviewEngineers,'secondAuditReviewEngineers--');
         console.log(thirdAuditEngineers,'thirdAuditEngineers--');
         console.log(specialistAuditPersonnel,'specialistAuditPersonnel--');
        //  return
        console.log(this.revokedType,'revokedType---')
         this.revokedType  ? this.model.billType = 'cancel' : this.model.billType = 'create'
        let projectName = filterMultiDictText(that.dictOptions['projectId'], that.model.projectId + '')
        this.model.bpmBizTitle = (that.model.projectId ? projectName + ' - ' : '') + this.userName + '-' + this.getCreateTime() + '-' + this.model.billNo
        httpAction(httpurl, {...this.model,firstAuditEngineers,secondAuditChairmanEngineers,secondAuditReviewEngineers,thirdAuditEngineers,specialistAuditPersonnel}, method).then((res) => {
          if (res.success) {
            that.$message.success(res.message);
            if (method == 'post') {
              that.model.id = res.result;
            }
            that.$emit('ok', type, that.model);
            if (this.formBpm) {
              let params = { id: this.formData.dataId };
              getAction(this.url.queryById, params).then((res) => {
                if (res.success) {
                  console.log('详情数据----');
                  
                  this.model1 = res.result
                  this.isSubmit = true
                }
              });
            }
          } else {
            that.$message.warning(res.message);
            that.$emit('unButtonDisable');
          }
        }).catch((error) => {
          that.$emit('unButtonDisable', error);
        }).finally(() => {
          that.confirmLoading = false;
        })
      },
    // 选择项目名称
    handleProjectIdChange(data) {
      console.log('出发孙康---1');
      let project = data.choseObj[0];
         console.log(project,'projec孙康---');
        //  console.log('出发孙康---');
        this.$set(this.model, 'operateTeamId', project.teamName)
      if (data && project) {
        // 项目编号（档案编号）
        this.$set(this.model, 'finalNo', project.finalNo)
        // 项目名称
        this.$set(this.model, 'projectName', project.projectName)
     
        // 签订单位
        this.$set(this.model, 'signUnit', project.signUnit)
        // 项目地址
        this.$set(this.model, 'areaCode', project.areaCode)
        this.$set(this.model, 'projectAddress', project.projectAddress)
        // 如果当前项目和任务关联的项目不一样则清空任务
        if (this.projectIdBack !== project.id) {
          this.projectIdBack = null
          this.$set(this.model, 'taskId', '')
          // 清空任务相关字段
          this.resetTaskFields()
        }
      } else {
        console.log('走else');
        
        // 清空所有
        this.restProjectFields()
        // 清空任务相关字段
        this.resetTaskFields()
        this.projectIdBack = null
        this.$set(this.model, 'taskId', '')
      }
    },
    // 选择关联任务
    handleTaskIdChange(data) {
      if (data && data.choseObj[0]) {
        let task = data.choseObj[0]
        // 当前projectId
        this.projectIdBack = this.model.projectId
        // 业务名称 categoryName
        this.$set(this.model, 'categoryName', task.categoryName) // 业务分类
        this.$set(this.model, 'taskType', task.taskType) // 任务类型
        console.log('task.taskType',task.taskType)
        // 项目负责人
        this.$set(this.model, 'projectLeading', task.projectLeading) // 项目负责人
        // 生产团队
        this.$set(this.model, 'productTeam', task.productTeam) // 生产团队
        // 实施部门
        this.$set(this.model, 'executeDepart', task.executeDepart) // 实施部门
        // 带出 带不出隐藏
        this.fillOrHide(task, false)
      } else {
        // 清空
        this.resetTaskFields()
        this.projectIdBack = null
      }
    },
    // 当前各个字段是否必填
    changeValidator() {
      // 去除所有表单中填写的字段
      this.clearAllInFlow();
      // 编辑页面 去除所有流程中修改的字段的校验
      if (this.formBpm === true) {
        // 项目专员
        if (this.projectCommissioner === false) {
          this.$set(this.validatorRules, 'engineerSecondReview', [
            { required: true, message: '请选择工程师（二审）!' }
          ])
        }
        // 项目负责人
        if (this.projectLeading === false) {
          // this.$set(this.validatorRules, 'reviewResult', [
          //   { required: true, message: '请选择项目评审情况!' }
          // ])
        }
        // 二审人员和总工办负责人
        if (this.otherEdit === false) {
          this.$set(this.validatorRules, 'secondReviewFee', [
            { required: true, message: '请输入二审审核费!' }
          ])
          this.$set(this.validatorRules, 'secondReviewProcess', [
            { required: true, message: '请输入二审审核费计算过程!' }
          ])


          // this.$set(this.validatorRules, 'feeTeamId', [
          //   { required: true, message: '请选择费用所属团队!' }
          // ])
        }
        if (this.formData.taskDefKey === 'task1743069459444') {
            this.$set(this.validatorRules, 'feeTeamId', [
            { required: true, message: '请选择费用所属团队!' }
          ])
          this.$set(this.validatorRules, 'reviewResult', [
            { required: true, message: '请选择项目评审情况!' }
          ])
          this.$set(this.validatorRules, 'projectResult', [
            { required: true, message: '请输入任务最终成果报告名称(全称)!' }
          ])

        }
        
      }
    },
    // 去除所有表单中填写字段
    clearAllInFlow() {
      // 去除验证
      this.$refs.form.clearValidate('engineerSecondReview')// 工程师（二审）
      this.$refs.form.clearValidate('reviewResult')// 项目评审情况
      this.$refs.form.clearValidate('secondReviewFee')// 二审审核费
      this.$refs.form.clearValidate('secondReviewProcess') // 二审审核费计算过程
      this.$refs.form.clearValidate('feeTeamId') // 费用所属团队
      // this.$refs.form.clearValidate('projectResult') // 
      this.$set(this.validatorRules, 'engineerSecondReview', null)
      this.$set(this.validatorRules, 'reviewResult', null)
      this.$set(this.validatorRules, 'secondReviewFee', null)
      this.$set(this.validatorRules, 'secondReviewProcess', null)
      this.$set(this.validatorRules, 'feeTeamId', null)
      // this.$set(this.validatorRules, 'projectResult', null)
    },
    fillOrHide(task, isEdit) {
      if (task && task.taskType && (task.taskType == 1 || task.taskType == 4)) {
        // 行业类别
      this.$set(this.model, 'industryCategory', task.industryCategory) // 行业类别
      // 行业系数
      this.$set(this.model, 'industryCoefficient', task.industryCoefficient) // 行业系数
      // 审批类别(环评)
      this.$set(this.model, 'approvalLevel', task.approvalLevel) // 审批类别
      // 审批系数
      this.$set(this.model, 'approvalCoefficient', task.approvalCoefficient) // 审批系数
      // 复杂程度
      this.$set(this.model, 'complexity', task.complexity) // 复杂程度
      // 复杂系数
      this.$set(this.model, 'complexCoefficient', task.complexCoefficient) // 复杂系数
      } else {
        // 行业类别
        this.$set(this.model, 'industryCategory', '') // 行业类别
        // 行业系数
        this.$set(this.model, 'industryCoefficient', '') // 行业系数
        // 审批类别(环评)
        this.$set(this.model, 'approvalLevel', '') // 审批类别
        // 审批系数
        this.$set(this.model, 'approvalCoefficient', '') // 审批系数
        // 复杂程度
        this.$set(this.model, 'complexity', '') // 复杂程度
        // 复杂系数
        this.$set(this.model, 'complexCoefficient', '') // 复杂系数
      }
      // 流程中和从列表页点击编辑进来的不允许修改是否隐藏字段 只允许选择任务弹框修改
      if (this.formBpm === false && !isEdit) {
        // 只要有这些字段 则不隐藏 没有则隐藏
        if (!!this.model.industryCategory || !!this.model.industryCoefficient ||
          !!this.model.approvalLevel || !!this.model.approvalCoefficient || !!this.model.complexity || !!this.model.complexCoefficient) {
          this.model.hideFlag = '1'
          this.hideFlag = '1'
        } else {
          this.model.hideFlag = '0'
          this.hideFlag = '0'
        }
      }
    },
    // 清空数据
    restProjectFields() {
      // 项目编号（档案编号）
      this.$set(this.model, 'finalNo', '')
      // 签订单位
      this.$set(this.model, 'signUnit', '')
      // 项目地址
      this.$set(this.model, 'areaCode', '')
      this.$set(this.model, 'projectAddress', '')
    },
    resetTaskFields() {
      // 业务名称 categoryName
      this.$set(this.model, 'categoryName', '') // 业务分类
      // 项目负责人
      this.$set(this.model, 'projectLeading', '') // 项目负责人
      // 生产团队
      this.$set(this.model, 'productTeam', '') // 生产团队
      // 实施部门
      this.$set(this.model, 'executeDepart', '') // 实施部门
      // 行业类别
      this.$set(this.model, 'industryCategory', '') // 行业类别
      // 行业系数
      this.$set(this.model, 'industryCoefficient', '') // 行业系数
      // 审批类别(环评)
      this.$set(this.model, 'approvalLevel', '') // 审批类别
      // 审批系数
      this.$set(this.model, 'approvalCoefficient', '') // 审批系数
      // 复杂程度
      this.$set(this.model, 'complexity', '') // 复杂程度
      // 复杂系数
      this.$set(this.model, 'complexCoefficient', '') // 复杂系数
      this.$set(this.model, 'taskType', null) // 
    },
    // 穿透
    // 项目名称
    getProjectDetail(id) {
      const that = this
      this.$nextTick(() => {
        getAction(this.url.queryProjectReportById, { id }).then((res) => {
          if (res.success) {
            const model = res.result
            that.$refs.reportForm.getDetail(model);
            that.$refs.reportForm.title = '项目一览表';
          }
        })
      })
    },
    getCreateTime() {
      let createTime = this.model.createTime;
      let date = createTime.substring(0, 10)
      return date.substring(0, 4) + '年' + date.substring(5, 7) + '月' + date.substring(8, 10) + '日';
    },
    needHide() {

      // 查询
      getAction(this.url.queryById, { id: this.model.id }).then(res => {
        console.log('任务刚刚---', res)
        if (res.success && !!res.result) {
          this.hideFlag = res.result.hideFlag
          this.$nextTick(()=>{
            // this.$refs.firstInstanceEngineerTable.dataSource = res.result.firstAuditEngineers || []
            // this.$refs.secondInstancePresidingEngineerForm.dataSource = res.result.secondAuditChairmanEngineers || []
            // this.$refs.secondInstanceReviewEngineerForm.dataSource = res.result.secondAuditReviewEngineers || []
            // this.$refs.thirdReviewEngineerForm.dataSource = res.result.thirdAuditEngineers || []
            // this.$refs.specializedAuditorsForm.dataSource = res.result.specialistAuditPersonnel || []

            this.$refs.firstInstanceEngineerTable.dataSource = res.result.firstAuditEngineers || []

                this.model.twoJointReviewRemark = res.result.twoJointReviewRemark || ''
                this.model.threeRemark = res.result.threeRemark || ''
                this.model.oneResultFile = res.result.oneResultFile || ''
                this.model.oneRemark = res.result.oneRemark || ''
                this.model.twoHostResultFile = res.result.twoHostResultFile || ''
                this.model.twoHostRemark = res.result.twoHostRemark || ''
                this.model.specializedRemark = res.result.specializedRemark || ''
                           
                  this.$refs.firstInstanceEngineerTable.model.remark = res.result.firstAuditEngineers && res.result.firstAuditEngineers[0].remark || ''
              this.$refs.firstInstanceEngineerTable.model.attachment = res.result.firstAuditEngineers && res.result.firstAuditEngineers[0].attachment || ''

              if(this.$refs.secondInstancePresidingEngineerForm){
                this.$refs.secondInstancePresidingEngineerForm.dataSource = res.result.secondAuditChairmanEngineers || []
              this.$refs.secondInstancePresidingEngineerForm.model.remark = res.result.secondAuditChairmanEngineers && res.result.secondAuditChairmanEngineers[0].remark || ''
              this.$refs.secondInstancePresidingEngineerForm.model.attachment = res.result.secondAuditChairmanEngineers && res.result.secondAuditChairmanEngineers[0].attachment || ''

              }
              if(this.$refs.secondInstanceReviewEngineerForm){
                this.$refs.secondInstanceReviewEngineerForm.dataSource = res.result.secondAuditReviewEngineers || []
                // this.$refs.secondInstanceReviewEngineerForm.model.remark = res.result.secondAuditReviewEngineers && res.result.secondAuditReviewEngineers[0].remark || ''
              }
              if(this.$refs.thirdReviewEngineerForm){
                this.$refs.thirdReviewEngineerForm.dataSource = res.result.thirdAuditEngineers || []
                // this.$refs.thirdReviewEngineerForm.model.remark = res.result.thirdAuditEngineers && res.result.thirdAuditEngineers[0].remark || ''

              }
              if(this.$refs.specializedAuditorsForm){
                this.$refs.specializedAuditorsForm.dataSource = res.result.specialistAuditPersonnel || []
                 this.$refs.specializedAuditorsForm.model.remark = res.result.specialistAuditPersonnel && res.result.specialistAuditPersonnel[0].remark || ''

              }


          })
        }
      })
    },
    initDictConfig() {
      initDictOptions('erp_omc_project,project_name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'projectId', res.result)
        }
      })
    },
    // 点击打印
    onPrint() {
      let print = new Print({
        el: '#reportAudit',
        popTitle: '报告审核单详情 · 禾美环保',
        endCallback() {

        }
      })
    }
  }
}
</script>
<style>
.ant-cascader-picker-label {
  color: rgba(0, 0, 0, 0.65);
}
</style>
